Re: Updatable views - Mailing list pgsql-patches

From Bernd Helmle
Subject Re: Updatable views
Date
Msg-id 73DFC08BAB444168CE5C5D9A@[172.26.14.247]
Whole thread Raw
In response to Updatable views  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Updatable views
List pgsql-patches
--On Montag, August 21, 2006 02:07:41 -0400 Alvaro Herrera
<alvherre@commandprompt.com> wrote:

> So, I'll appreciate if somebody else takes the responsability to fix the
> remaining issues.  I've put a lot of XXX's and some FIXME's.  Some
> functions are in need of some comments as well.

While working on Alvaro's suggestions to fix the code i got the opinion
that we need to reject any attempts to name a user defined rule
as

"_INSERT"
"_NOTHING_INSERT"
"_DELETE"
"_NOTHING_DELETE"
"_UPDATE"
"_NOTHING_UPDATE"

because this confuses the code when replacing an existing implicit
rule with its own user defined one:

bernd@[local]:bernd #= create or replace view v_second as select id, name,
usr from second where usr =
current_user with check option;
NOTICE:  CREATE VIEW will create implicit INSERT/UPDATE/DELETE rules
CREATE VIEW
bernd@[local]:bernd #= CREATE OR REPLACE RULE "_INSERT" AS ON INSERT TO
v_second DO INSTEAD NOTHING;
ERROR:  tuple already updated by self

This is because the code tries to drop the existing implicit insert rule
from pg_rewrite
and then to replace it with the new one (note the "_INSERT" caption of the
rule, any
other labeled rule works as expected).

We could avoid this by using a CommandCounterIncrement() (brute force
method),
but it seems to me that we should do the same here as with "_RETURN" rules
at the moment.

Any comments?

--
  Thanks

                    Bernd

pgsql-patches by date:

Previous
From: Dhanaraj M
Date:
Subject: Re: Have psql show current sequnce values - (Resubmission)
Next
From: Tom Lane
Date:
Subject: Re: Updatable views